14 research outputs found

    A Language for Specifying Recursive Traversals of Object Structures

    No full text
    We present a domain-specific language for specifying recursive traversals of object structures, for use with the visitor pattern. Traversals are traditionally specified as iterations, forcing the programmer to adopt an imperative style, or are hard-coded into the program or visitor. Our proposal allows a number of problems best approached by recursive means to be tackled with the visitor pattern, while retaining the benefits of a separate traversal specification. Keywords: Visitor Pattern, Recursive Programming, Separation of Concerns 1 Introduction The visitor pattern [GHJV95] allows a programmer to write behavior that traverses an object structure without embedding assumptions about the structure into the computational code. This is a result of separating navigational code from code that performs the computation. In most versions of the visitor pattern, the exact sequence in which parts of an object are visited is hard-coded, either into the object or into the visitor. We refer to ..

    Aspect-Oriented Programming with Aspectual Methods

    No full text
    We use Gregor Kiczales' definition of an aspect: a modular unit of crosscutting implementation and present a useful kind of aspect-oriented programming in Java. By focussing on a limited, but commonly occuring set of aspects, we are able to provide the Java library DJ that allows us to write aspectual methods whose ad-hoc implementation cuts across several classes. An aspectual method is evaluated in the context of a class graph and it invokes a traversal-style method that traverses through objects following has-a links guided by a traversal specification. We present the key elements of the library and we connect aspectual methods with the AspectJ terminology. Several examples demonstrate the advantages and limitations of aspectual methods. We hope that aspect-oriented programming will be better understood if it can be practiced, even in limited form, directly in Java. This paper shows one way how to achieve this through the DJ library

    A Language for Specifying Recursive Traversals of Object Structures

    No full text
    We present a domain-specific language for specifying recursive traversals of object structures, for use with the visitor pattern. Traversals are traditionally specified as iterations, forcing the programmer to adopt an imperative style, or are hard-coded into the program or visitor. Our proposal allows a number of problems best approached by recursive means to be tackled with the visitor pattern, while retaining the benefits of a separate traversal specification. Keywords: Visitor Pattern, Recursive Programming, Separation of Concerns 1 Introduction The visitor pattern [GHJV95] allows a programmer to write behavior that traverses an object structure without embedding assumptions about the structure into the computational code. This is a result of separating navigational code from code that performs the computation. In most versions of the visitor pattern, the exact sequence in which parts of an object are visited is hard-coded, either into the object or into the visitor. We refer to ..
    corecore